﻿@{
    Layout = "~/Views/_LayoutPage1.cshtml";
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title></title>
</head>
<body>
    <div class="loading-mask" id="isloading" style="display:none">
        <div class="loading-wrapper">
            <div class="loading-icon loading">
            </div><div class="loading-msg">加载中...</div>
        </div>
    </div>
    <div class="page" id="root">
        <input type="hidden" id="KSDM" value="@ViewBag.model.KSDM" />
        <input type="hidden" id="YSDM" value="@ViewBag.model.YSDM" />
        <input type="hidden" id="PBID" value="@ViewBag.model.PBID" />
        <input type="hidden" id="ZBLB" value="@ViewBag.model.ZBLB" />
        <input type="hidden" id="GHLB" value="@ViewBag.model.GHLB" />
        <input type="hidden" id="GZRQ" value="@ViewBag.model.GZRQ" />
        <input type="hidden" id="GHF" value="@ViewBag.model.GHF" />
        <input type="hidden" id="KSMC" value="@ViewBag.model.KSMC" />
        <input type="hidden" id="YSXM" value="@ViewBag.model.YSXM" />

        <div data-reactroot="">
            <div class="ui-alert" id="showmsg" style="display:none">
                <div class="text">请选择就诊人</div>
            </div>
            <div class="info-confirm-2">
                <ul class="list g-space">
                    <li><span class="item">医院</span><span class="item-inner">浙中医大二院</span></li>
                    <li><span class="item">科室</span><span class="item-inner">@ViewBag.model.KSMC</span></li>
                    <li><span class="item">医生</span><span class="item-inner">@ViewBag.model.YSXM</span></li>
                    <li>
                        <span class="item">就诊时间</span><span class="item-inner txt-prompt">@ViewBag.model.GZRQ @ViewBag.model.ZBLB</span>
                    </li>
                </ul>
                <ul class="list list-link">
                    <li class="txt-arrowlink">
                        <span class="item">选择号源</span>
                        <span class="item-inner item-right">
                            <select id="HYID">
                                @if (ViewBag.hyxx != null)
                                {
                                    for (int i = 0; i < ViewBag.hyxx.Count; i++)
                                    {
                                        <option value="@ViewBag.hyxx[i].HYID">@ViewBag.hyxx[i].JZXH 号 @ViewBag.hyxx[i].KSSJ</option>
                                    }
                                }

                            </select>

                        </span>
                    </li>
                    <li>
                        <a href="/UserInfo/Index?pbid=@ViewBag.model.PBID" class="txt-arrowlink">
                            <span class="item">就诊人</span>
                            <span id="brid" class="item-inner item-right">@ViewBag.user.brxm</span>
                            <input id="sfzh" type="hidden" value="@ViewBag.user.sfzh">
                            <input id="brxb" type="hidden" value="@ViewBag.user.sex">
                            <input id="sjhm" type="hidden" value="@ViewBag.user.sjhm">
                            <input id="brxm" type="hidden" value="@ViewBag.user.brxm">
                        </a>
                    </li>
                </ul><div class="list-pay-msg clearfix g-space">
                    <span class="txt-info">应付</span><span>￥ @ViewBag.model.GHF</span>
                    <div class="item-right">
                        <span class="txt-info">实付</span><span class="txt-highlight">￥ @ViewBag.model.GHF</span>
                    </div>
                </div>
                <div class="msg-rules" style="text-align:center;font-size:12px">
                    <a href="/Yygh/YyRole">请遵守平台预约挂号规则</a>
                </div>
                <a onclick="yygh()" class="btn btn-block g-footer J_Submit">确认</a>
            </div>
        </div>
    </div>

    <script>
        function yygh() {
            if ($("#sfzh").val() == "") {
                $(".ui-alert").show();

                setTimeout(function () {
                    $(".ui-alert").hide();
                }, 3000)
            } else {
                $("#isloading").show();
                var yymodel = {
                    HYID: $("#HYID").val(),
                    KSDM: $("#KSDM").val(),
                    YSDM: $("#YSDM").val(),
                    YSXM: $("#YSXM").val(),
                    KSMC: $("#KSMC").val(),
                    PBID: $("#PBID").val(),
                    SFZH: $("#sfzh").val(),
                    BRXB: $("#brxb").val(),
                    SJHM: $("#sjhm").val(),
                    BRXM: $("#brxm").val(),
                    ZBLB: $("#ZBLB").val(),
                    GHLB: $("#GHLB").val(),
                    JZXH: $("#HYID").val().split('_')[1],
                    GZRQ: $("#GZRQ").val(),
                    GHF: $("#GHF").val(),
                }
                $.post("/Yygh/Yygh", yymodel, function (result) {
                    if (result != "-1") {
                        window.location.href = "/Yygh/YyDetail?hyid=" + result.split(",")[0] + "&pzhm=" + result.split(",")[1];
                    } else {
                        $("#isloading").hide();
                        alert("预约失败");
                    }
                   
                })
                
            }
           
        }
    </script>
</body>
</html>
